<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://unpkg.com/react@16/umd/react.development.js"></script>
    <script src="https://unpkg.com/react-dom@16/umd/react-dom.development.js"></script>
    <script src="https://unpkg.com/babel-standalone@6.26.0/babel.js"></script>
</head>

<body>

    <div id="app"></div>
    <script type="text/babel">
        // class MyDom extends React.Component {

        //     render() {
        //         return (
        //             <div>类组件---{this.props.name}----{this.props.gender}</div>
        //         )
        //     }

        // }
        // let obj = {
        //     name: '张三',
        //     gender: '男'
        // }
        // ReactDOM.render(<MyDom {...obj} />, document.getElementById("app"))


        class MyDom extends React.Component {
            

            

            render() {

                const {age,agg} =this.props
                return (
                    <div>类组件---{this.props.name}----{this.props.gender}----{Number(age)+1}----{agg+2}</div>
                )
            }

        }

        ReactDOM.render(<MyDom name="张三" age="15" agg={33} speak={speak}/>, document.getElementById("app"))
        function speak() {
            console.log(23);
        }
//props是只读的，不可以修改

    </script>
</body>

</html>